package com.party.mem.web.dto.input.wechat;

import com.party.core.model.wechat.WechatMaterial;
import org.apache.commons.beanutils.BeanUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 微信菜单输入视图JSON包装
 * Created by admin on 2017/9/1.
 */
public class WechatMenuInputWrapper {

    //菜单列
    private List<WechatMenuInput> menuList;

    public List<WechatMenuInput> getMenuList() {
        return menuList;
    }

    public void setMenuList(List<WechatMenuInput> menuList) {
        this.menuList = menuList;
    }

    public static List<WechatMaterial> transformMaterial(List<WechatMaterialInput> list,String mediaId,String memberId){
        List<WechatMaterial> materials = new ArrayList<WechatMaterial>();
        for(WechatMaterialInput input : list){
            WechatMaterial material = new WechatMaterial();
            try {
                BeanUtils.copyProperties(material,input);
            } catch (Exception e) {
                e.printStackTrace();
            }
            material.setMemberId(memberId);
            material.setMediaId(mediaId);
            materials.add(material);
        }
        return materials;
    }
}
